\section{Derivation of Green's First Identity} The divergence
theorem states that the divergence of a vector integrated over a
volume $V$ enclosed by a surface $S$ is equal to the total outflow
of flux through the surface. In mathematical form,
\begin{equation}\label{eqn:DivergenceTheorem}
    \int_V{\nabla\cdot\vec{A}\;dv} = \oint_S{\vec{A}\cdot d\vec{s}}
\end{equation}
To derive Green's first identity let,
\begin{equation}\label{eqn:APsiPhi}
    \vec{A} = \Psi\nabla\Phi
\end{equation}
and then substitute into (\ref{eqn:DivergenceTheorem}).
\begin{equation}\label{eqn:DivergenceTheorem2}
    \int_V{\nabla\cdot\Psi\nabla\Phi\;dv} = \oint_S{\Psi\nabla\Phi\cdot d\vec{s}}
\end{equation}
By expanding and rearranging (\ref{eqn:DivergenceTheorem2}) yields
Greens first identity.
\begin{equation}\label{eqn:GFI}
    \int_V{\Psi\nabla^2\Phi\;dv} = -\int_V{\nabla\Psi\cdot\nabla\Phi\;dv}+\oint_S{\Psi\nabla\Phi\cdot\hat{u} \:ds}
\end{equation}
where $\hat{u}$ is a unit vector normal and directed outward from
the surface $S$. Equation (\ref{eqn:GFI}) can also be written as,
\begin{align}
    \int_V{\Psi\nabla^2\Phi\;dv} &= -\int_V{\nabla\Psi\cdot\nabla\Phi\;dv}+\oint_S{\Psi\frac{\partial\Phi}{\partial u}
    \:ds}&\text{(3d)}\label{eqn:GFI3d}\\
    \int_S{\Psi\nabla_\perp^2\Phi\;ds} &= -\int_S{\nabla_\perp\Psi\cdot\nabla_\perp\Phi\;ds}+\oint_C{\Psi\frac{\partial\Phi}{\partial u}
    \:d\ell}&\text{(2d)}\label{eqn:GFI2d}\\
    \int_a^b{\Psi\frac{d^2\Phi}{du^2}\;du} &= -\int_a^b{\frac{d\Psi}{du}\frac{d\Phi}{du}\;du}+\left[\Psi\frac{d\Phi}{du}\right]_a^b
    &\text{(1d)}\label{eqn:GFI1d}
\end{align}
where $\frac{\partial\Phi}{\partial u}=\nabla\Phi\cdot\hat{u}$

A useful specialized case is derived by letting $\Phi=\Psi$ and substituting into (\ref{eqn:GFI2d}) which yields,
\begin{align}
\int_S{\nabla_\perp\Psi\cdot\nabla_\perp\Psi\;ds} &= -\int_S{\Psi\nabla_\perp^2\Psi\;ds}+\oint_C{\Psi\frac{\partial\Psi}{\partial u}
\:d\ell}\label{eqn:GFI2d2}
\end{align}
If $\Psi$ must satisfy the wave equation (which is assumed in this case), then $\nabla^2\Psi=\gamma^2\Psi=-k^2\Psi$ and (\ref{eqn:GFI2d2}) simplifies too,
\begin{align}
\int_S{\nabla_\perp\Psi\cdot\nabla_\perp\Psi\;ds} &= (-\gamma_\bot^2=k_\bot^2)\int_S{\Psi^2\;ds}+\oint_C{\Psi\frac{\partial\Psi}{\partial u}
\:d\ell}\label{eqn:GFI2d3}
\end{align}
If the boundary conditions are either \emph{Neumann} ($\frac{\partial\Psi}{\partial u}$=0) or \emph{Dirichlet} ($\Psi=0$) when evaluated on the boundary then (\ref{eqn:GFI2d3}) reduces too,
\begin{align}
\int_S{\nabla_\perp\Psi\cdot\nabla_\perp\Psi\;ds} &= (-\gamma_\bot^2=k_\bot^2)\int_S{\Psi^2\;ds}\label{eqn:GFI2d4}
\end{align}

\section{Identity from Stokes Theorem}
Starting with Stokes theorem,
\begin{equation}\label{eqn:stokestheorem2}
    \oint_C\vec{A}\cdot{d\vec{\ell}}=\int_S\nabla\times\vec{A}\cdot\;d\vec{s}
\end{equation}
Substituting (\ref{eqn:APsiPhi}) into (\ref{eqn:stokestheorem2}) gives,
\begin{align}
    \oint_C\Psi\nabla\Phi\cdot{d\vec{\ell}}=\int_S\nabla\times\Psi\nabla\Phi\cdot\;d\vec{s}\label{eqn:stokestheorem2psiphi}
\end{align}
By expanding and rearranging (\ref{eqn:stokestheorem2psiphi}) yields
the following identity.
\begin{equation}\label{eqn:SFI} \oint_C\Psi\nabla\Phi\cdot{\hat{\ell}}\;d\ell=\int_S\nabla\Psi\times\nabla\Phi\cdot\hat{w}\;ds+\int_S\Psi\nabla\times\nabla\Phi\cdot\hat{w}\;ds
\end{equation}
where $\hat{\ell}$ is a unit vector tangent to the curve $C$ and pointing in the direction of integration and $\hat{w}$ is a unit vector normal to the surface $S$. Since $\nabla\times\nabla\Phi=0$, (\ref{eqn:SFI}) reduces to the following,
\begin{equation}\label{eqn:SFI2}
 \int_S\nabla\Psi(\vec{r})\times\nabla\Phi(\vec{r})\cdot\hat{w}\;d{s}=\oint_C\Psi(\vec{r})\frac{\partial\Phi(\vec{r})}{\partial\ell}\;d\ell
\end{equation}
where $\frac{\partial\Phi}{\partial\ell}=\nabla\Phi\cdot\hat{\ell}$. Equation (\ref{eqn:SFI2}) can be reduced to a 2-d case as,
\begin{equation}\label{eqn:SFI2d}    \int_S\nabla_{\bot}\Psi(\vec{r}_\bot)\times\nabla_{\bot}\Phi(\vec{r}_\bot)\cdot\hat{w}\;ds=\oint_C\Psi(\vec{r}_\bot)\frac{\partial\Phi(\vec{r}_\bot)}{\partial\ell}\;d\ell
\end{equation}
where $\hat{w}$ is constant.
A useful specialized case is derived by letting $\Phi=\Psi$ and substituting into (\ref{eqn:SFI2d}) which yields,
\begin{align}
\int_S\nabla_{\bot}\Psi(\vec{r}_\bot)\times\nabla_{\bot}\Psi(\vec{r}_\bot)\cdot\hat{w}\;ds=\oint_C\Psi(\vec{r}_\bot)\frac{\partial\Psi(\vec{r}_\bot)}{\partial\ell}\;d\ell\label{eqn:SFI2d0}
\end{align}
If $\Psi=0$ evaluated on the boundary then,
\begin{align}
\int_S\nabla_{\bot}\Psi(\vec{r}_\bot)\times\nabla_{\bot}\Psi(\vec{r}_\bot)\cdot\hat{w}\;ds=0\label{eqn:SFI2d1}
\end{align}
